<template>
    <div>
        <el-form label-width="90px">
            <el-form-item label="商品数据">
                <div>
                    <el-radio-group v-model="content.dataStatus">
                        <el-radio :label="1">显示</el-radio>
                        <el-radio :label="0">隐藏</el-radio>
                    </el-radio-group>
                    <div class="form-tips">如隐藏，前端详情页则不显示商品数据模块</div>
                </div>
            </el-form-item>
            <el-form-item label="商品库存">
                <div>
                    <el-radio-group v-model="content.stockStatus">
                        <el-radio :label="1">开启</el-radio>
                        <el-radio :label="0">关闭</el-radio>
                    </el-radio-group>
                    <div class="form-tips">如果开启，则商品详情页显示库存</div>
                </div>
            </el-form-item>
            <el-form-item label="商品销量">
                <div>
                    <el-radio-group v-model="content.salesStatus">
                        <el-radio :label="1">开启</el-radio>
                        <el-radio :label="0">关闭</el-radio>
                    </el-radio-group>
                    <div class="form-tips">如果开启，则商品详情页显示销量</div>
                </div>
            </el-form-item>
            <el-form-item label="商品浏览量">
                <div>
                    <el-radio-group v-model="content.viewsStatus">
                        <el-radio :label="1">开启</el-radio>
                        <el-radio :label="0">关闭</el-radio>
                    </el-radio-group>
                    <div class="form-tips">如果开启，则商品详情页显示浏览量</div>
                </div>
            </el-form-item>
        </el-form>
    </div>
</template>
<script lang="ts" setup>
import type { PropType } from 'vue'
import type options from './options'
const limit = 5
type OptionsType = ReturnType<typeof options>
const props = defineProps({
    content: {
        type: Object as PropType<OptionsType['content']>,
        default: () => ({})
    },
    styles: {
        type: Object as PropType<OptionsType['styles']>,
        default: () => ({})
    }
})

const handleAdd = () => {
    if (props.content.data?.length < limit) {
        props.content.data.push({
            image: '',
            name: '',
            link: {}
        })
    } else {
        feedback.msgError(`最多添加${limit}张图片`)
    }
}
const handleDelete = (index: number) => {
    if (props.content.data?.length <= 1) {
        return feedback.msgError('最少保留一张图片')
    }
    props.content.data.splice(index, 1)
}
</script>

<style lang="scss" scoped>
.content {
    padding: 10px;
    border-radius: 4px;
    background: rgba(65, 83, 255, 0.06);
    .desc {
        font-weight: 400;
        font-size: 12px;
        text-align: left;
        color: #4153ff;
    }
}
</style>
